<template>
  <comcard>
    <div slot="com_header">订单详情</div>
    <div slot="com_con">
      <el-row>
        <el-col :xs="24" :sm="9">
          <el-form :model="oneObj">
            <el-form-item label="订单编号" label-width="80px">
              <el-input
                type="text"
                disabled
                v-model="oneObj.orderNo"
              ></el-input>
            </el-form-item>
            <el-form-item label="下单时间" label-width="80px">
              {{ oneObj.orderTime | timeMF }}
            </el-form-item>
            <el-form-item label="联系电话" label-width="80px">
              <el-input type="text" v-model="oneObj.phone"></el-input>
            </el-form-item>
            <el-form-item label="收货人" label-width="80px">
              <el-input type="text" v-model="oneObj.consignee"></el-input>
            </el-form-item>
            <el-form-item label="收货地址" label-width="80px">
              <el-input type="text" v-model="oneObj.deliverAddress"></el-input>
            </el-form-item>
            <el-form-item label="送达时间" label-width="80px">
              {{ oneObj.deliveryTime | timeMF }}
            </el-form-item>
            <el-form-item label="备注" label-width="80px">
              <el-input type="text" v-model="oneObj.remarks"></el-input>
            </el-form-item>
            <el-form-item label="订单金额" label-width="80px">
              <el-input type="text" v-model="oneObj.orderAmount"></el-input>
            </el-form-item>
            <el-form-item label="订单状态" label-width="80px">
              <el-input type="text" v-model="oneObj.orderState"></el-input>
            </el-form-item>
          </el-form>
          <el-button @click="save()" type="primary" size="small"
            >保存</el-button
          >
        </el-col>
      </el-row>
    </div>
  </comcard>
</template>

<script>
import ComCard from "../../components/card";
import { api_one, api_update } from "../../api/order.js";
export default {
  components: {
    ComCard,
  },
  data() {
    return {
      oneObj: {},
    };
  },
  mounted() {
    this.queryOne();
  },
  methods: {
    async queryOne() {
      let rst = await api_one({ id: this.$route.query.id });
      console.log(rst);
      this.oneObj = rst.data;
    },

    async save() {
      let rst = await api_update(this.oneObj);
      let { code, msg } = rst;
      if (code == 0) {
        this.$message.success(msg);
      }
      console.log(rst);
    },
  },
};
</script>

<style lang="less" scoped>
</style>